-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't mix Vite plugins when spawning temporary Vite server #6368
Conversation
🦋 Changeset detectedLatest commit: fdce124 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
We need the command, not the mode. |
for preview, integrations should take care, and for vite user plugins we should also filter them before starting Vite preview |
don't merge yet, preparing test |
We've another problem, when a plugin is included it can be excluded on sync call since we don't have command/action when using apply with function, we need to review it. You can check this line https://github.com/withastro/astro/blob/main/packages/astro/src/core/build/index.ts#L85, Astro creates vite for build then before run the build Astro creates a new config for sync. EDIT: seems to be ok now, I'll update the test again, I was using apply function arguments wrong 😬 ... |
} else { | ||
result = vite.mergeConfig(result, settings.config.vite || {}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add else case without plugins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great fix and awesome test!
Test failure is unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against the change, but I'd like to see better comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some suggestions too clear up in-line comments. Great fix though, was unaware Vite plugins have an apply
utility!
Co-authored-by: Ben Holmes <hey@bholmes.dev>
Changes
Testing
Added simple test with disparate plugins for static build.
Docs
Bug fix only: maybe we need to add some hints for integrations registering plugins, check for example
@vite-pwa/astro
integration logic: https://github.com/vite-pwa/astro/blob/main/src/index.ts#L31